import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout'
const routerHistory = createWebHashHistory()
const router = createRouter({
    history: routerHistory,
    routes: [
        {
            path: '/',
            name: 'home',
            redirect: '/user',
            meta: { title: '首页' },
            component: Layout,
            children: [
                {
                    path: 'access',
                    component: () => import('@/views/home/access/index.vue'),
                    name: 'access',
                    meta: {menuId: '1', title: '信息管理',path:'access' , code: '1-1', icon: 'iconfont icon-renyuan', keepAlive: true }
                },{
                    path: 'imgs',
                    component: ()=>import('@/views/home/imgs/index.vue'),
                    name:'imgs',
                    meta:{menuId: '2', title: '图片',path:'imgs', code: '1-2', icon: 'iconfont icon-renyuan', keepAlive: true }
                },{
                    path: 'project',
                    component: ()=>import('@/views/home/project/index.vue'),
                    name:'project',
                    meta:{menuId: '3', title: '个人计划',path:'project', code: '1-3', icon: 'iconfont icon-renyuan', keepAlive: true }
                },{
                    path: 'music',
                    component: ()=>import('@/views/home/music/index.vue'),
                    name:'music',
                    meta:{menuId: '4', title: '音乐',path:'music', code: '1-4', icon: 'iconfont icon-renyuan', keepAlive: true }
                }
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('../views/login/login.vue'),
            hidden: true
        },
        {
            path: '/user',
            component: ()=>import('@/views/user/index.vue'),
            name:'user',
            meta:{menuId: '4', title: '个人',path:'user', code: '', icon: 'iconfont icon-renyuan', keepAlive: true }
        },
        {
            path: '/404',
            meta: { title: 'Not Found' },
            component: () => import('@/views/404.vue'),
            hidden: true
        },
        { path: '/:pathMatch(.*)', redirect: '/404', hidden: true }
    ]
})
export default router